<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:insert="~{include :: header('菜单树选择')}" />
	<th:block th:insert="~{include :: ztree-css}" />
</head>
<style>
	body{height:auto;font-family: "Microsoft YaHei";}
	button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
</style>
<body class="hold-transition">
<!-- Site wrapper -->
<div class="container-fluid p-2">
	<input id="treeId"   name="treeId"    type="hidden" th:value="${menu.menuId}"/>
	<input id="treeName" name="treeName"  type="hidden" th:value="${menu.menuName}"/>
	<div class="text-right">
		<a href="#" class="btn btn-xs btn-success" onclick="$.tree.expand()">
			<i class="fa fa-plus"></i> 展开</a>
		<a href="#" class="btn btn-xs btn-default" onclick="$.tree.collapse()">
			<i class="fa fa-minus"></i> 折叠</a>
	</div>
	<div id="tree" class="ztree treeselect"></div>
</div>
	<th:block th:insert="~{include :: footer}" />
	<th:block th:insert="~{include :: ztree-js}" />
	<script th:inline="javascript">
		$(function() {
			var url = "/menu/menuTreeData";
			var options = {
				url: url,
				expandLevel: 1,
				onClick: zOnClick
			};
			$.tree.init(options);
		});
		
		function zOnClick(event, treeId, treeNode) {
			$("#treeId").val(treeNode.id);
			$("#treeName").val(treeNode.name);
		}
	</script>
</body>
</html>
